#ifndef __COMPILER_H__
#define __COMPILER_H__
#include <iostream>
#include <array>
#include <vector>
#include <set>
#include <fstream>
#include <string.h>

#include "../scanner/scanner.h"
#include "../parser/parser.h"
#include "../Token/Token.h"
#include "../ast/SymbolTable.hpp"
#define TEMP_FILE_NAME          "panda.src"
#define TOKEN_SEQUENCE          "panda.tok"
#define DATAMEMBER_INFO         "panda.dmi"
#define FUNCMEMBER_INFO         "panda.fmi"
#define GRAMMAR_TREE            "panda.tree"
#define ASSEMBLE_FILE           "panda.asm"
#define LANGUAGE_EXTENSION      ".pd"
using namespace std;
struct compiler
{
public:
    compiler():outputTempFile(TEMP_FILE_NAME){ASM::setFile(ASSEMBLE_FILE);}
    bool preprocess(int argc,char* argv[]);         // 预处理
    bool lexicalAnalysis();
    bool grammaticalAnalysis_1();
    bool grammaticalAnalysis_2();
    bool grammaticalAnalysis_3();


    bool compile();

    bool import(const string& packagePath,string packageName);

    Parser parser;
    set<string> importTable;
    ofstream outputTempFile;
};


#endif